#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 100005;
int n, m;
int a[N], dat[N * 4];
void build(int u, int l, int r){
    if(l == r) {
        dat[u] = a[l];
    } else{
        int mid = (l + r) / 2;
        build (u * 2, l, mid);
        build (u * 2 + 1, mid + 1, r);
        dat[u] = min(dat[u * 2], dat[u * 2 + 1]);
    }
}
void change (int u, int l, int r, int x, int v) {
	if (l == r) {
		dat[u] = v;
		return;
	}
	int mid = (l + r) / 2;
	if (x <= mid) {
		change (u * 2, l, mid, x, v);
	} else {
		change (u * 2 + 1, mid + 1, r, x, v);
	}
	dat[u] = min (dat[u * 2], dat[u * 2 + 1]);
}
int query (int u, int nowl, int nowr, int l, int r) {
    int val = 0x7fffffff;
    if(l <= nowl && r >= nowr){
        val = dat[u];
    } else {
        int mid = (nowl + nowr) / 2;
        if(l <= mid) {
        	val = min (val, query (u * 2 , nowl, mid, l, r));
		}
        if(r > mid) {
        	val = min (val, query (u * 2 + 1, mid + 1, nowr, l, r));
		}
    }
    return val;
}

int main(){
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
    	scanf("%d", &a[i]);
	}
    build (1, 1, n);
    int x, y, z;
	for (int i = 1; i <= m; i++) {
		scanf ("%d%d%d", &x, &y, &z);
		if (x == 1) {
			printf("%d ", query (1, 1, n, y, z));
		} else {
			change (1, 1, n, y, z);
		}
	}
}
